﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;

namespace Data
{
    public class LoaiPhongRepository
    {
        public List<LoaiPhongDTO> GetLoaiPhongList()
        {
            List<LoaiPhongDTO> listLoaiPhong = new List<LoaiPhongDTO>();
            try
            {
                QuanLyKhachSanEntities context = new QuanLyKhachSanEntities();
                var query = from loaiPhong in context.LoaiPhongList
                            select loaiPhong;
                foreach (var loaiPhongEF in query)
                {
                    LoaiPhongDTO loaiPhongDTO = new LoaiPhongDTO();
                    loaiPhongDTO.MaLoaiPhong = loaiPhongEF.MaLoaiPhong;
                    loaiPhongDTO.TenLoaiPhong = loaiPhongEF.TenLoaiPhong;
                    loaiPhongDTO.DonGia = (double)loaiPhongEF.DonGia;
                    listLoaiPhong.Add(loaiPhongDTO);
                }

            }
            catch (System.Exception)
            {
            }
            return listLoaiPhong;
        }
    }
}
